package com.student.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.student.pojo.Cj;
import com.student.service.CjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 是一个鸽子啊
 * @date 2020/4/14
 * @qq 364826415
 */
@RestController
public class CjAjaxController {
    @Autowired
    @Qualifier("cjServiceImpl")
    CjService cjService;
    @RequestMapping("/queryCjByID")
    private String queryCjByID(String cjID) throws JsonProcessingException {
        Cj cj = cjService.queryCjByID(Integer.parseInt(cjID));
        ObjectMapper objectMapper = new ObjectMapper();
        String val = objectMapper.writeValueAsString(cj);
        return val;
    }

}
